<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="file" id="file1" multiple><br>
    <button>上传</button><br>
    <script>
        const request = new XMLHttpRequest();
        const fileObj = document.querySelector("#file1");
        const btnObj = document.querySelector("button");
        btnObj.addEventListener("click",function(){
            if(fileObj.files.length<=0){
                return alert("请选择文件");
            }else{
                const formData = new FormData();
                for(let i=0;i<fileObj.files.length;i++){
                    formData.append('files',fileObj.files[i]);
                }
                request.open("POST","http://localhost:8080/Day06_response_request_war_exploded/reqUpload/demo02")
                request.send(formData);
            }

        })
    </script>
</body>
</html>